home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Task
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "Task List"
- ClientHeight = 4410
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 7410
- ControlBox = 0 'False
- Height = 4815
- Left = 1035
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4410
- ScaleWidth = 7410
- Top = 1140
- Width = 7530
- Begin ListBox ListHidden
- Height = 225
- Left = 4140
- Sorted = -1 'True
- TabIndex = 10
- Top = 4200
- Visible = 0 'False
- Width = 3315
- End
- Begin Timer Timer1
- Interval = 1000
- Left = 7200
- Top = 3540
- End
- Begin CommandButton CmdRefresh
- BackColor = &H00C0C0C0&
- Caption = "&Refresh List"
- Height = 435
- Left = 300
- TabIndex = 7
- TabStop = 0 'False
- Top = 3780
- Width = 2235
- End
- Begin CommandButton CmdOkay
- BackColor = &H00C0C0C0&
- Caption = "O &K A Y"
- Height = 435
- Left = 4860
- TabIndex = 5
- TabStop = 0 'False
- Top = 3780
- Width = 2235
- End
- Begin CommandButton CmdIcons
- BackColor = &H00C0C0C0&
- Caption = "&Arrange Icons"
- Height = 435
- Left = 4860
- TabIndex = 4
- TabStop = 0 'False
- Top = 3300
- Width = 2235
- End
- Begin CommandButton CmdEnd
- BackColor = &H00C0C0C0&
- Caption = "&End Task"
- Height = 435
- Left = 2580
- TabIndex = 3
- TabStop = 0 'False
- Top = 3780
- Width = 2235
- End
- Begin CommandButton CmdSwitch
- BackColor = &H00C0C0C0&
- Caption = "&Switch To"
- Height = 435
- Left = 2580
- TabIndex = 2
- TabStop = 0 'False
- Top = 3300
- Width = 2235
- End
- Begin CommandButton CmdInfo
- BackColor = &H00C0C0C0&
- Caption = "Task &Info"
- Height = 435
- Left = 300
- TabIndex = 1
- TabStop = 0 'False
- Top = 3300
- Width = 2235
- End
- Begin ListBox List1
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Terminal"
- FontSize = 9
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 2010
- Left = 240
- Sorted = -1 'True
- TabIndex = 0
- Top = 420
- Width = 6915
- End
- Begin Label LabelHdr
- BackStyle = 0 'Transparent
- Caption = "LabelHdr"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Terminal"
- FontSize = 9
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00800000&
- Height = 195
- Left = 240
- TabIndex = 11
- Top = 180
- Width = 6915
- End
- Begin Label LblFreeMem
- Alignment = 1 'Right Justify
- BackStyle = 0 'Transparent
- Caption = "FreeMem"
- ForeColor = &H00800000&
- Height = 315
- Left = 2580
- TabIndex = 9
- Top = 2880
- Width = 4455
- End
- Begin Label LblFreeRes
- BackStyle = 0 'Transparent
- Caption = "FreeRes"
- ForeColor = &H00800000&
- Height = 315
- Left = 360
- TabIndex = 8
- Top = 2880
- Width = 2175
- End
- Begin Label LabelCount
- Alignment = 2 'Center
- BackStyle = 0 'Transparent
- Caption = "Task Count"
- ForeColor = &H00000000&
- Height = 255
- Left = 240
- TabIndex = 6
- Top = 2520
- Width = 6915
- End
- Declare Function GetDesktopHwnd% Lib "User" ()
- Declare Function ArrangeIconicWindows% Lib "User" (ByVal hWnd%)
- Sub CmdEnd_Click ()
- x = List1.ListIndex
- FormPassString = "END"
- AppTitle$ = ExtractField(x, 1)
- ClassName$ = LCase$(ExtractField(x, 2))
- WdwState$ = LCase$(ExtractField(x, 3))
- If AppTitle$ = DemoMain.Caption Then
- Unload Me
- Exit Sub
- End If
- If WdwState$ = "hidden" Then
- MsgBox "Can NOT end a HIDDEN application!", 48, "End Task"
- List1.SetFocus
- Exit Sub
- End If
- If ClassName$ <> "tty" Then
- AppActivate AppTitle$
- SendKeys "%{F4}", True
- Else
- AppActivate AppTitle$
- SendKeys "% T%T{TAB}~", True
- End If
- List1.SetFocus
- CmdRefresh_Click
- End Sub
- Sub CmdIcons_Click ()
- DThwnd% = GetDesktopHwnd()
- x% = ArrangeIconicWindows(DThwnd%)
- List1.SetFocus
- End Sub
- Sub CmdInfo_Click ()
- If List1.ListIndex = -1 Or List1.ListCount = 0 Then
- MsgBox "No item selected!", 64, "Task Info"
- Exit Sub
- End If
- x = List1.ListIndex
- sTitle$ = ExtractField(x, 1)
- sClass$ = ExtractField(x, 2)
- sWdwState$ = ExtractField(x, 3)
- sFullPath$ = LCase$(ExtractField(x, 4))
- iInstance$ = Trim$(ExtractField(x, 5))
- ihWnd$ = Trim$(ExtractField(x, 6))
- ihDC$ = Trim$(ExtractField(x, 7))
- iMenu$ = Trim$(ExtractField(x, 8))
- msg$ = "Title:" + Chr$(9) + Chr$(9) + sTitle$ + nl
- msg$ = msg$ + "Class Name:" + Chr$(9) + sClass$ + nl
- msg$ = msg$ + "Wdw State:" + Chr$(9) + sWdwState$ + nl
- msg$ = msg$ + "Full Path:" + Chr$(9) + sFullPath$ + nl
- msg$ = msg$ + "hInstance:" + Chr$(9) + iInstance$ + nl
- msg$ = msg$ + "hWnd:" + Chr$(9) + Chr$(9) + ihWnd$ + nl
- msg$ = msg$ + "hDC:" + Chr$(9) + Chr$(9) + ihDC$ + nl
- msg$ = msg$ + "hMenu:" + Chr$(9) + Chr$(9) + iMenu$
- MsgBox msg$, 48, "Selected Task Info"
- List1.SetFocus
- End Sub
- Sub CmdOkay_Click ()
- FormPassString = "OKAY"
- Unload Me
- End Sub
- Sub CmdRefresh_Click ()
- Screen.MousePointer = 11
- RefreshView
- Screen.MousePointer = 0
- List1.SetFocus
- End Sub
- Sub CmdSwitch_Click ()
- x = List1.ListIndex
- FormPassString = "SWITCH"
- FormPassString2 = ExtractField(x, 1)
- FormPassString3 = LCase$(ExtractField(x, 3))
- If FormPassString3 = "hidden" Then
- MsgBox "Can NOT switch to a HIDDEN application!", 48, "Switch To"
- List1.SetFocus
- Exit Sub
- End If
- Unload Me
- End Sub
- Function ExtractField$ (RecordItem, FieldItem)
- 'When using a hidden module like this, it is best to
- 'set the Sort property of both ListBoxes to the same value
- If RecordItem > ListHidden.ListCount Then
- ExtractField = ""
- Exit Function
- End If
- ThisRecord$ = ListHidden.List(RecordItem)
- delimiter$ = Chr$(9)
- If GetTokenCount(ThisRecord$, delimter$) > FieldItem Then
- ExtractField = ""
- Exit Function
- End If
- ReturnString$ = Space$(255)
- GetToken ThisRecord$, delimiter$, FieldItem, ReturnString$
- ExtractField = TrimAtNull(ReturnString$)
- End Function
- Sub Form_Load ()
- FormCenterScreen Me
- LabelHdr.Caption = "Application Title" + Space$(28) + "Wdw State"
- ReDim tabsets%(1)
- tabsets%(0) = 0
- tabsets%(1) = 45 * 4
- dummy% = OutMessage(List1.hWnd, 1043, 2, tabsets%(0))
- RefreshView
- LblFreeRes.Caption = "": LblFreeMem.Caption = ""
- Screen.MousePointer = 0
- End Sub
- Sub Form_Paint ()
- DoForm3D Me, "raised", 2, 0
- DoForm3D Me, "sunken", 2, 2
- DoControl3D List1, "sunken", 2
- End Sub
- Sub List1_DblClick ()
- CmdInfo_Click
- End Sub
- Sub RefreshView ()
- LBfillTaskInfo ListHidden.hWnd, False
- If ListHidden.ListCount = 0 Then
- LabelCount.Caption = ""
- Exit Sub
- End If
- List1.Clear
- For x = 0 To ListHidden.ListCount - 1
- sTitle$ = ExtractField(x, 1)
- sState$ = ExtractField(x, 3)
- If sTitle$ <> Me.Caption Then
- List1.AddItem sTitle$ + Chr$(9) + sState$ + Chr$(9)
- Else
- ThisTask% = x
- End If
- Next x
- ListHidden.RemoveItem ThisTask%
- ItemCount% = ListHidden.ListCount
- If ItemCount% > 1 Then
- word$ = " tasks "
- Else
- word$ = " task "
- End If
- LabelCount.Caption = Format$(ItemCount%, "##0") + " active" + word$ + "detected"
- List1.ListIndex = 0
- End Sub
- Sub Timer1_Timer ()
- ret& = GetFreeMem("system")
- LblFreeRes.Caption = "Free Resources: " + Format$(ret&) + "%"
- ret& = GetFreeMem("space")
- LblFreeMem.Caption = "Free Memory: " + Format$(ret& / 1024, "###,###,##0") + " KB"
- End Sub
-